package com.lemon.service.impl;

import com.lemon.entity.Student;
import com.lemon.mapper.StudentMapper;
import com.lemon.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Levin
 */
@Service
public class StudentServiceImpl implements StudentService {

    // 注意 命名要遵循驼峰命名  而不是
    // 错误写法：StudentMapper => StudentMapper
    // 错误写法：StudentMapper => studentMapper
    // 首字母要小写


    private final StudentMapper studentMapper;

    @Autowired
    public StudentServiceImpl(StudentMapper studentMapper) {
        this.studentMapper = studentMapper;
    }

    @Override
    public List<Student> queryStudentForList() {
        // 仔细分析下这个名字    query = 查询  student 学生  for list  接收的类型
        return this.studentMapper.queryStudentForList();
    }

    @Override
    public Student selectStudentById(Integer id) {
        // 这个也是   select = 查询   student 学生   by id  根据 xxx 查找
        // 一般 集合用 queryXXX  单条记录用  selectXXX  或者 getXX
        return this.studentMapper.selectStudentById(id);
    }
}